/**
 *====================================================
 * 文件名称: FinanceEvidentiaryServiceImpl.java
 * 修订记录：
 * No    日期				作者(操作:具体内容)
 * 1.    2015年09月23日	chenxy(创建:创建文件)
 *====================================================
 * 类描述：(说明未实现或其它不应生成javadoc的内容)
 */
package com.yuexunit.finance.project.service;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import com.yuexunit.finance.project.entity.FinanceEvidentiaryEntity;
import com.yuexunit.inject.annotation.Implements;
import com.yuexunit.persist.PersistUtil;

/**
 * @ClassName: FinanceEvidentiaryServiceImpl
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @author chenxy
 * @date 2015年09月23日 18:56:17
 */
@Implements(FinanceEvidentiaryService.class)
public class FinanceEvidentiaryServiceImpl implements FinanceEvidentiaryService {

	@Override
	public Long createEvidentiary(FinanceEvidentiaryEntity entity) {
		entity.setReadFlag(Boolean.FALSE);
		PersistUtil.insert(entity);
		return entity.getEvidentiaryId();
	}

	@Override
	public void updateEvidentiary(FinanceEvidentiaryEntity financeEvidentiaryEntity) {
		PersistUtil.update(financeEvidentiaryEntity);
	}

	@Override
	public void deleteEvidentiary(Long evidentiaryId) {
		PersistUtil.delete(FinanceEvidentiaryEntity.class, evidentiaryId);
	}

	@Override
	public FinanceEvidentiaryEntity inquireEvidentiary(Long evidentiaryId) {
		return PersistUtil.get(FinanceEvidentiaryEntity.class, evidentiaryId);
	}

	@Override
	public List<FinanceEvidentiaryEntity> inquireEvidentiaryList(Long financeId) {
		DetachedCriteria criteria = DetachedCriteria.forClass(FinanceEvidentiaryEntity.class);
		criteria.add(Restrictions.eq("financeId", financeId));
		return PersistUtil.get(criteria);
	}

	@Override
	public List<FinanceEvidentiaryEntity> inquireCategoryEvidentiaryList(Long categoryId) {
		DetachedCriteria criteria = DetachedCriteria.forClass(FinanceEvidentiaryEntity.class);
		criteria.add(Restrictions.eq("evidentiaryCategoryId", categoryId));
		return PersistUtil.get(criteria);
	}

}
